package com.hjlh.aimedical.common.utils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class DateUtils {
    public static List<Date> getSomeDayBeforeToday(int days , Date currentDate) {
        List<Date> dates = new ArrayList<Date>();
        currentDate.setHours(23);
        currentDate.setMinutes(59);
        currentDate.setSeconds(59);
        dates.add(currentDate);
        for(int i = 0; i < days; i ++){
            currentDate.setHours(23);
            currentDate.setMinutes(59);
            currentDate.setSeconds(59);
            Date as = new Date(currentDate.getTime()-24*60*60*1000);
            currentDate = as ;
            dates.add(as);
        }
        return dates ;
    }
    
    public static String dateFormat(Date time){
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return dateFormat.format(time);
    }
}
